﻿// -----------------------------------------------------------------------
// <copyright file="DecompressorContract.cs">
// Copyright (c) 2013 Andrey Veselov. All rights reserved.
// License:  Microsoft Public License (MS-PL)
// Contacts: http://andrey.moveax.com  andrey@moveax.com
// </copyright>
// -----------------------------------------------------------------------

namespace PortableImagingLibrary.Png.Compressors
{
    using System.Diagnostics.Contracts;

    [ContractClassFor(typeof(IDecompressor))]
    internal abstract class DecompressorContract : IDecompressor
    {
        public byte[] OutputBuffer
        {
            get
            {
                Contract.Ensures(Contract.Result<byte[]>() != null);
                Contract.Ensures(Contract.Result<byte[]>().Length > 0);
                
                return default(byte[]);
            }
        }

        public int BytesPerLine
        {
            get
            {
                Contract.Ensures(Contract.Result<int>() > 0);

                return default(int);
            }

            set
            {
                Contract.Requires(value > 0);
            }
        }

        public void SetCurrentChunkData(byte[] data)
        {
            Contract.Requires(data != null);
            Contract.Requires(data.Length > 0);
        }

        public abstract bool ReadLine();

        public abstract void Dispose();
    }
}
